import { http } from '@/utils/http'

/**
 * 资讯相关接口
 */
// 新增资讯
export const addInformation = (data: any) => {
    return http.post<any>('/news/save', data)
}
// 编辑资讯
export const editInformation = (data: any) => {
    return http.post<any>('/news/update', data)
}
// 资讯详情
export const getInformation = (id: any) => {
    return http.get<any>(`/news/detail?id=${id}`)
}

/**
 * 发布活动相关接口
 */
// 新增
export const addActivity = (data: any) => {
    return http.post<any>('/activity/save', data)
}
// 编辑
export const editActivity = (data: any) => {
    return http.post<any>('/activity/update', data)
}
// 详情
export const getActivity = (id: any) => {
    return http.get<any>(`/activity/detail?id=${id}`)
}

/**
 * 用户报名活动、、发布作品相关接口
 * 有活动id就是报名活动，没有的话就是发布作品
 */
// 新增
export const addCompositionAndRegister = (data: any) => {
    return http.post<any>('/activityParticipation/save', data)
}
// 编辑
export const editCompositionAndRegister = (data: any) => {
    return http.post<any>('/activityParticipation/update', data)
}
// 详情
export const getCompositionAndRegister = (id: any) => {
    return http.get<any>(`/activityParticipation/detail?id=${id}`)
}
